package com.centit.airplaneinfo_db.po;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.centit.airplanebaseinfo.po.AirplaneBaseinfo;
import com.centit.airplanebaseinfo.service.AirplaneBaseinfoManager;
import com.centit.airplaneinfo_db.dao.DbHbxxDao;
import com.centit.airplaneinfo_db.dao.DbOldInfoDjpqlDao;
import com.centit.airplaneinfo_db.dao.DbOldInfoGcwtlDao;
import com.centit.airplaneinfo_db.dao.DbRecordDao;
import com.centit.importData.dao.JdndjhDao;
import com.centit.importData.dao.ShhzfjfdjDao;
import com.centit.importData.po.Jdndjh;
import com.centit.importData.po.Shhzfjfdj;
import com.centit.support.algorithm.UuidOpt;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class ExportExcelUtil {
    public DbRecordDao dbRecordDao;
    public DbOldInfoGcwtlDao dbOldInfoGcwtlDao;
    public DbHbxxDao dbHbxxDao;
    public DbOldInfoDjpqlDao dbOldInfoDjpqlDao;
    public void initDao(DbRecordDao dbRecordDao,DbOldInfoGcwtlDao dbOldInfoGcwtlDao,DbHbxxDao dbHbxxDao,DbOldInfoDjpqlDao dbOldInfoDjpqlDao){
        this.dbRecordDao=dbRecordDao;
        this.dbOldInfoGcwtlDao=dbOldInfoGcwtlDao;
        this.dbHbxxDao=dbHbxxDao;
        this.dbOldInfoDjpqlDao=dbOldInfoDjpqlDao;
    }

    private FormulaEvaluator formulaEvaluator;

    //导入表：收费统计表
    public static Map<String,List<String>> RESULT_STR_LIST_All_POOL=new HashMap<>();
    public static int DJ_SHEET_NUM=0;//单价所在sheet
    public static Integer[] A_DJ_HS_COORDINATE={7,9};//A检（含）以下及航线维修服务单价坐标;横-纵
    public static Integer[] A_DJ_BHS_COORDINATE={4,9};//A检（含）以下及航线维修服务单价坐标;横-纵
    public static Integer[] ZZJ_DJ_HS_COORDINATE={7,10};//周转件航材保障服务(含税)
    public static Integer[] ZZJ_DJ_BHS_COORDINATE={4,10};//周转件航材保障服务（不含税）

    public static int GCWT_SHEET_NUM=3;//工程委托类所在sheet
    public static String TABLE_TITLE_GCGLFW ="工程管理服务";//
    public static String TABLE_TITLE_HXWXFW ="航线维修服务";//航线维修服务
    public static String TABLE_TITLE_ZZJHCBZFW ="周转件航材保障服务";//周转件航材保障服务
    public static String TABLE_TITLE_APU ="APU保障服务";//APU保障服务


    public static Integer[] HBXX_DATA_LINE={3,4,21};//周转件航材保障服务（不含税）

    public static Integer[] DJPQ_DATA_LINE_OLD={2,3,4};//定检喷漆old（不含税）

    public static Integer[] DJPQ_DATA_LINE_NEW={2,3,4};//定检喷漆new（不含税）


    public static int DJPQ_SHEET_NUM=4;//定检喷漆类所在sheet


    public static boolean streamSearch(Integer[] array, int target) {
        return Arrays.stream(array).anyMatch(element -> element == target);
    }
    /**
     * 获取单元格的值
     * @param cell
     * @return
     */
    public String getCellValue(Cell cell) throws Exception{
        if(cell == null) return "";
        if(cell.getCellType() == 1){
            return cell.getStringCellValue();
        }else if(cell.getCellType() == 4){
            return String.valueOf(cell.getBooleanCellValue());
        }else if(cell.getCellType() == 2){
            String value="";
            // 评估公式并获取结果值
            CellValue cellValue = formulaEvaluator.evaluate(cell);
            if (cellValue.getCellType() == 0) {
                String numValue= String.valueOf(Math.round(cellValue.getNumberValue()));
                if(numValue.endsWith(".0")){
                    numValue=numValue.substring(0,numValue.length()-2);
                }
                value= numValue;
                //System.out.print(cellValue.getNumberValue() + "\t-------0-------");

            } else {
                value= cellValue.getStringValue();
                //System.out.print(cellValue.getStringValue() + "\t-------1----");
            }
            //return cell.getCellFormula() ;
            return value ;

        }else if(cell.getCellType() == 0){
            //数值类型去。0
            String numValue= String.valueOf(cell.getNumericCellValue());
            if(numValue.endsWith(".0")){
                numValue=numValue.substring(0,numValue.length()-2);
            }
            return numValue;
        }
        return cell.getStringCellValue();

    }

    public String getCellValueByCoordinate(Sheet sheet,Integer[] coordinate,String loginUser){
        String value = "";
        Row row = sheet.getRow(coordinate[1]-1);
        if(row!=null){
            try {
                value = getCellValue(row.getCell(coordinate[0]-1));
                //某些列需要转日期
//                            if(streamSearch(SHHZFJFDJ_SHEET_DATE_CELL,j)){
//                                Date date = HSSFDateUtil.getJavaDate(Double.parseDouble(lineContent));
//                                lineContent=shortDate.format(date);
//                            }
            } catch (Exception e) {
                RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+coordinate[1]+"行，第"+coordinate[0]+"列数据解析失败");
            }
        }
        return value;
    }



    /**
     * 导入：
     * @param file
     * @param loginUser
     * @param type
     * @return
     * @throws Exception
     */
    public String importExcel(MultipartFile file, String loginUser, String type) throws Exception{
        Sheet sheetDj;
        Sheet sheetGcgl;
        SimpleDateFormat shortDate=new SimpleDateFormat("yyyy-MM-dd");
        if(type.endsWith(".xls")){
            Workbook workbook= new HSSFWorkbook(file.getInputStream());
            sheetDj = workbook.getSheetAt(DJ_SHEET_NUM);    //获得第一个表单sheet
            sheetGcgl = workbook.getSheetAt(GCWT_SHEET_NUM);    //获得第一个表单sheet
            formulaEvaluator= workbook.getCreationHelper().createFormulaEvaluator();
            int numberofsheets =workbook.getNumberOfSheets();
            for(int i=0;i<numberofsheets; i++){
                Sheet sheet = workbook.getSheetAt(i);
                String sheetName = sheet.getSheetName();
                if(sheetName.indexOf("江苏")>-1){
                    sheetDj = sheet;    //获得第一个表单sheet
                }else if(sheetName.indexOf("工程委托")>-1){
                    sheetGcgl = sheet;    //获得第一个表单sheet
                }
                //System.out.println("sheet name:"+ sheetName);
            }
        }else {
            XSSFWorkbook workbook= new XSSFWorkbook(file.getInputStream());
            sheetDj = workbook.getSheetAt(DJ_SHEET_NUM);    //获得第一个表单sheet
            sheetGcgl = workbook.getSheetAt(GCWT_SHEET_NUM);    //获得第一个表单sheet
            formulaEvaluator= workbook.getCreationHelper().createFormulaEvaluator();
            int numberofsheets =workbook.getNumberOfSheets();
            for(int i=0;i<numberofsheets; i++){
                Sheet sheet = workbook.getSheetAt(i);
                String sheetName = sheet.getSheetName();
                if(sheetName.indexOf("江苏")>-1){
                    sheetDj = sheet;    //获得第一个表单sheet
                }else if(sheetName.indexOf("工程委托")>-1){
                    sheetGcgl = sheet;    //获得第一个表单sheet
                }
                //System.out.println("sheet name:"+ sheetName);
            }
        }
        /*step1:获取单价*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step1:获取单价------------");
        String dbRecordId=UuidOpt.getUuidAsString32();
        try {
            DbRecord dbRecord=new DbRecord(dbRecordId,type+"_对比记录",loginUser,"1",
                    getCellValueByCoordinate(sheetDj,A_DJ_BHS_COORDINATE,loginUser),
                    getCellValueByCoordinate(sheetDj,A_DJ_HS_COORDINATE,loginUser),
                    getCellValueByCoordinate(sheetDj,ZZJ_DJ_BHS_COORDINATE,loginUser),
                    getCellValueByCoordinate(sheetDj,ZZJ_DJ_HS_COORDINATE,loginUser));
            System.out.println("----dbRecord------dbRecord---"+JSON.toJSONString(dbRecord));
            dbRecordDao.saveNewObject(dbRecord);

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤一执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤一:获取单价结束------------");

        /*step2:保存航线维修服务信息*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step2:保存航线维修服务对比信息------------");
        List<Map<Integer,String[]>> sheetDataList=new ArrayList<>();
        try {
            for(int i = 10; i < 14;i++){  //第一行是标题
                Row row = sheetGcgl.getRow(i);
                if(row!=null){
                    Map<Integer,String[]> rowData=new HashMap<>();
                    String[] thisRowDataArr=new String[6];
                    thisRowDataArr[5]=String.valueOf(i);
                    for(int j=0;j<5;j++) {
                        String lineContent = "";
                        try {
                            lineContent = getCellValue(row.getCell(j));
                        } catch (Exception e) {
                            RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+(i+1)+"行，第"+(j+1)+"列数据解析失败");
                        }
                        thisRowDataArr[j]=lineContent;
                    }
                    rowData.put(i,thisRowDataArr);
                    sheetDataList.add(rowData);
                }
            }

            sheetDataList.stream().forEach(r->{
                Map<Integer,String[]> rowData=r;
                //基本上每个map只有一条数据
                rowData.forEach((key,value)->{
                    String[] rowDataArr=value;
                    DbOldInfoGcwtl dbOldInfoGcwtl=new DbOldInfoGcwtl("2", dbRecordId, "", "",
                            "", "", rowDataArr[0], "",
                            "", "", rowDataArr[1], rowDataArr[2],
                            rowDataArr[3], rowDataArr[4], "",Integer.valueOf(rowDataArr[5]),"1");
                    System.out.println("-----dbOldInfoGcwtl----"+JSON.toJSONString(dbOldInfoGcwtl));
                    dbOldInfoGcwtlDao.saveNewObject(dbOldInfoGcwtl);
                });
            });


            Row row = sheetGcgl.getRow(14);
            if(row!=null){
                String[] thisRowDataArr=new String[5];
                for(int j=0;j<5;j++) {
                    String lineContent = "";
                    try {
                        lineContent = getCellValue(row.getCell(j));
                    } catch (Exception e) {
                        RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第14行，第"+(j+1)+"列数据解析失败");
                    }
                    thisRowDataArr[j]=lineContent;
                }
                DbOldInfoGcwtl dbOldInfoGcwtl=new DbOldInfoGcwtl("2", dbRecordId,
                        thisRowDataArr[3], thisRowDataArr[4],
                        thisRowDataArr[2], "", "", "",
                        "", "", "", "",
                        "", "", "",14,"2");
                System.out.println("-----dbOldInfoGcwtl----"+JSON.toJSONString(dbOldInfoGcwtl));
                dbOldInfoGcwtlDao.saveNewObject(dbOldInfoGcwtl);
            }

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤2执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤2:保存航线维修服务对比信息结束------------");


        /*step2:保存航线维修服务信息*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step2:保存航线维修服务对比信息------------");
        List<Map<Integer,String[]>> sheetDataList3=new ArrayList<>();
        try {
            for(int i = 18; i < 22;i++){  //第一行是标题
                Row row = sheetGcgl.getRow(i);
                if(row!=null){
                    Map<Integer,String[]> rowData=new HashMap<>();
                    String[] thisRowDataArr=new String[6];
                    thisRowDataArr[5]=String.valueOf(i);
                    for(int j=0;j<5;j++) {
                        String lineContent = "";
                        try {
                            lineContent = getCellValue(row.getCell(j));
                        } catch (Exception e) {
                            RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+(i+1)+"行，第"+(j+1)+"列数据解析失败");
                        }
                        thisRowDataArr[j]=lineContent;
                    }
                    rowData.put(i,thisRowDataArr);
                    sheetDataList3.add(rowData);
                }
            }

            sheetDataList3.stream().forEach(r->{
                Map<Integer,String[]> rowData=r;
                //基本上每个map只有一条数据
                rowData.forEach((key,value)->{
                    String[] rowDataArr=value;
                    DbOldInfoGcwtl dbOldInfoGcwtl=new DbOldInfoGcwtl("3", dbRecordId, "", "",
                            "", "", rowDataArr[0], "",
                            "", "", rowDataArr[1], rowDataArr[2],
                            rowDataArr[3], rowDataArr[4], "",Integer.valueOf(rowDataArr[5]),"1");
                    System.out.println("-----dbOldInfoGcwtl----"+JSON.toJSONString(dbOldInfoGcwtl));
                    dbOldInfoGcwtlDao.saveNewObject(dbOldInfoGcwtl);
                });
            });


            Row row = sheetGcgl.getRow(22);
            if(row!=null){
                String[] thisRowDataArr=new String[5];
                for(int j=0;j<5;j++) {
                    String lineContent = "";
                    try {
                        lineContent = getCellValue(row.getCell(j));
                    } catch (Exception e) {
                        RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第14行，第"+(j+1)+"列数据解析失败");
                    }
                    thisRowDataArr[j]=lineContent;
                }
                DbOldInfoGcwtl dbOldInfoGcwtl=new DbOldInfoGcwtl("3", dbRecordId,
                        thisRowDataArr[3], thisRowDataArr[4],
                        thisRowDataArr[2], "", "", "",
                        "", "", "", "",
                        "", "", "",22,"2");
                System.out.println("-----dbOldInfoGcwtl----"+JSON.toJSONString(dbOldInfoGcwtl));
                dbOldInfoGcwtlDao.saveNewObject(dbOldInfoGcwtl);
            }

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤2执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤2:保存航线维修服务对比信息结束------------");


        return "";

    }


    /**
     * 导入：上传航班信息
     * @param file
     * @param loginUser
     * @param type
     * @return
     * @throws Exception
     */
    public String importExcelHbxx(MultipartFile file, String loginUser, String type,String recId) throws Exception{
        Sheet sheet;
        SimpleDateFormat shortDate=new SimpleDateFormat("yyyy-MM-dd");
        if(type.endsWith(".xls")){
            Workbook workbook= new HSSFWorkbook(file.getInputStream());
            sheet = workbook.getSheetAt(DJ_SHEET_NUM);

        }else {
            XSSFWorkbook workbook= new XSSFWorkbook(file.getInputStream());
            sheet = workbook.getSheetAt(DJ_SHEET_NUM);
        }
        /*step2:保存航班信息*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step2:保存航班信息------------");
        int count = sheet.getLastRowNum()+1;//总行数
        List<Map<Integer,String[]>> sheetDataList=new ArrayList<>();
        try {
            for(int i = 1; i < count;i++){  //第一行是标题
                Row row = sheet.getRow(i);
                if(row!=null){
                    Map<Integer,String[]> rowData=new HashMap<>();
                    String[] thisRowDataArr=new String[3];
                    for(int j=0;j<HBXX_DATA_LINE.length;j++) {
                        String lineContent = "";
                        Integer lineNum=HBXX_DATA_LINE[j]-1;
                        try {
                            lineContent = getCellValue(row.getCell(lineNum));
                        } catch (Exception e) {
                            RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+(i+1)+"行，数据解析失败");
                        }
                        thisRowDataArr[j]=lineContent;
                    }
                    rowData.put(i,thisRowDataArr);
                    sheetDataList.add(rowData);
                }
            }

            sheetDataList.stream().forEach(r->{
                Map<Integer,String[]> rowData=r;
                //基本上每个map只有一条数据
                rowData.forEach((key,value)->{
                    String[] rowDataArr=value;
                    DbHbxx dbHbxx=new DbHbxx(recId,loginUser,rowDataArr[1],
                            rowDataArr[0],rowDataArr[2]);
                    dbHbxxDao.saveNewObject(dbHbxx);
                });
            });

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤2执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤2:保存航班信息结束------------");

        return "";

    }




    /**
     * 导入：(dingjian)
     * @param file
     * @param loginUser
     * @param type
     * @return
     * @throws Exception
     */
    public String importExcelDjpq(MultipartFile file, String loginUser, String type) throws Exception{
        Sheet sheetDjpq;
        SimpleDateFormat shortDate=new SimpleDateFormat("yyyy-MM-dd");
        if(type.endsWith(".xls")){
            Workbook workbook= new HSSFWorkbook(file.getInputStream());
            sheetDjpq = workbook.getSheetAt(DJPQ_SHEET_NUM);    //获得第一个表单sheet
            int numberofsheets =workbook.getNumberOfSheets();
            for(int i=0;i<numberofsheets; i++){
                Sheet sheet = workbook.getSheetAt(i);
                String sheetName = sheet.getSheetName();
                if(sheetName.indexOf("定检")>-1&&sheetName.indexOf("喷漆")>-1){
                    sheetDjpq = sheet;    //获得第一个表单sheet
                }
                //System.out.println("sheet name:"+ sheetName);
            }
        }else {
            XSSFWorkbook workbook= new XSSFWorkbook(file.getInputStream());
            sheetDjpq = workbook.getSheetAt(DJPQ_SHEET_NUM);    //获得第一个表单sheet
            int numberofsheets =workbook.getNumberOfSheets();
            for(int i=0;i<numberofsheets; i++){
                Sheet sheet = workbook.getSheetAt(i);
                String sheetName = sheet.getSheetName();
                if(sheetName.indexOf("定检")>-1&&sheetName.indexOf("喷漆")>-1){
                    sheetDjpq = sheet;    //获得第一个表单sheet
                }
                //System.out.println("sheet name:"+ sheetName);
            }
        }
        /*step1:保存定检对比记录*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step1:保存定检对比记录------------");
        String dbRecordId=UuidOpt.getUuidAsString32();
        try {
            DbRecord dbRecord=new DbRecord(dbRecordId,type+"_定检对比记录",loginUser,
                    "2",
                    "",
                    "",
                    "",
                    "");
            System.out.println("----dbRecord------dbRecord---"+JSON.toJSONString(dbRecord));
            dbRecordDao.saveNewObject(dbRecord);

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤一执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤一:获取单价结束------------");

        /*step2:保存定检服务信息*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step2:保存定检服务信息------------");
        List<Map<Integer,String[]>> sheetDataList=new ArrayList<>();
        int count = sheetDjpq.getLastRowNum()+1;//总行数
        try {
            for(int i = 1; i < count;i++){  //第一行是标题
                Row row = sheetDjpq.getRow(i);
                if(row!=null){
                    Map<Integer,String[]> rowData=new HashMap<>();
                    String[] thisRowDataArr=new String[3];

                    for(int j=0;j<DJPQ_DATA_LINE_OLD.length;j++) {
                        String lineContent = "";
                        Integer lineNum=DJPQ_DATA_LINE_OLD[j]-1;
                        try {
                            lineContent = getCellValue(row.getCell(lineNum));
                        } catch (Exception e) {
                            RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+(i+1)+"行，第"+(lineNum+1)+"列数据解析失败");
                        }
                        thisRowDataArr[j]=lineContent;
                    }
                    if(StringUtils.isNotEmpty(thisRowDataArr[0])
                            &&StringUtils.isNotEmpty(thisRowDataArr[1])
                    &&thisRowDataArr[0].indexOf("机型")==-1){
                        rowData.put(i,thisRowDataArr);
                        sheetDataList.add(rowData);
                    }

                }
            }

            sheetDataList.stream().forEach(r->{
                Map<Integer,String[]> rowData=r;
                //基本上每个map只有一条数据
                rowData.forEach((key,value)->{
                    String[] rowDataArr=value;
                    DbOldInfoDjpql dbOldInfoDjpql=new DbOldInfoDjpql(dbRecordId,rowDataArr[0], rowDataArr[1],
                            rowDataArr[2], "1");
                    //System.out.println("-----dbOldInfoDjpql----"+JSON.toJSONString(dbOldInfoDjpql));
                    dbOldInfoDjpqlDao.saveNewObject(dbOldInfoDjpql);
                });
            });


        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤2执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤2:保存定检服务信息结束------------");



        return "";

    }


    /**
     * 导入：上传机队年度计划表
     * @param file
     * @param loginUser
     * @param type
     * @return
     * @throws Exception
     */
    public String importExcelJdndjh(MultipartFile file, String loginUser, String type,String recId) throws Exception{
        Sheet sheet;
        if(type.endsWith(".xls")){
            Workbook workbook= new HSSFWorkbook(file.getInputStream());
            sheet = workbook.getSheetAt(0);
        }else {
            XSSFWorkbook workbook= new XSSFWorkbook(file.getInputStream());
            sheet = workbook.getSheetAt(0);
        }
        /*step2:保存机队年度计划信息*/
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------step2:保存机队年度计划信息------------");
        int count = sheet.getLastRowNum()+1;//总行数
        List<Map<Integer,String[]>> sheetDataList=new ArrayList<>();
        try {
            for(int i = 1; i < count;i++){  //第一行是标题
                Row row = sheet.getRow(i);
                if(row!=null){
                    Map<Integer,String[]> rowData=new HashMap<>();
                    String[] thisRowDataArr=new String[3];
                    for(int j=0;j<DJPQ_DATA_LINE_NEW.length;j++) {
                        String lineContent = "";
                        Integer lineNum=DJPQ_DATA_LINE_NEW[j]-1;
                        try {
                            lineContent = getCellValue(row.getCell(lineNum));
                        } catch (Exception e) {
                            RESULT_STR_LIST_All_POOL.get(loginUser).add("error:第"+(i+1)+"行，数据解析失败");
                        }
                        thisRowDataArr[j]=lineContent;
                    }
                    rowData.put(i,thisRowDataArr);
                    sheetDataList.add(rowData);
                }
            }

            sheetDataList.stream().forEach(r->{
                Map<Integer,String[]> rowData=r;

                rowData.forEach((key,value)->{
                    String[] rowDataArr=value;

                    DbOldInfoDjpql dbOldInfoDjpql=new DbOldInfoDjpql(recId,rowDataArr[0], rowDataArr[1],
                            rowDataArr[2], "2");
                    dbOldInfoDjpqlDao.saveNewObject(dbOldInfoDjpql);
                });
            });

        }catch (Exception e){
            e.printStackTrace();
            RESULT_STR_LIST_All_POOL.get(loginUser).add("wrong:步骤2执行中遇到不可忽视的错误，已终止程序");
            return "";
        }
        RESULT_STR_LIST_All_POOL.get(loginUser).add("-----------步骤2:保存机队年度计划结束------------");

        return "";

    }



}
